home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 12
/
CU Amiga Magazine's Super CD-ROM 12 (1997)(EMAP Images)(GB)[!][issue 1997-07].iso
/
CUCD
/
Games
/
DestructivePoker
/
sources
/
sources.lha
/
cardpile.h
< prev
next >
Wrap
C/C++ Source or Header
|
1997-02-13
|
2KB
|
61 lines
/*
cardpile.h (cJakoPakan määrittelytiedosto)
V1.00 - 141096 Kimmo Teräväinen
----- ------ -------------------------------------
V0.01 141096 Started
V0.05 151096 pakka osaa tärkeimmät toiminnot
V0.06 201096 cPakka periytyy caKuviosta
V0.07 211096 cPakka -> caPakka, josta cJakoPakka, cKasiPakka ja
cPoistoPakka periytyy.
V0.08 031196 caPakka -> caCardPile
V0.10 111196 No longer abstract.
V0.15 201196 Perfect standard pile (deck of cards).
V0.17 261196 cCard-array -> cIMGCard * -array
130297 Commented in English.
INFO:
cCardPile is virtual deck of cards.
*/
#ifndef DC1_POKER_CARDPILE
#define DC1_POKER_CARDPILE
#include "card.h"
class cCardPile {
protected:
cIMGCard **cards; // pointer array of cards
int n,max; // amount of card and size of array
cPoint pos;
void insert(cIMGCard *card) { if(n<max) cards[n++]=card; }
public:
cCardPile(int lkm,int x,int y) :
pos(x,y)
{
n=max=0;
if(lkm) cards=new cIMGCard*[lkm]; else cards=NULL;
if(cards) max=lkm;
}
virtual ~cCardPile() { if(cards) delete [] cards; }
virtual cIMGCard *Deal(); // removes last card
virtual cIMGCard *Remove(int); // removes asked card
virtual void Insert(cIMGCard *); // inserts card to pile
virtual void Insert(cCardPile &); // takes cards from other pile
virtual void Erase() { n=0; } // clear pile, but
// 'leaves cards to table'
virtual int Can_Insert() const { return n<max; }
virtual int Can_Insert(cIMGCard *) const { return Can_Insert(); }
// virtual void Shuffle() {} // Shuffle
};
#endif